﻿#region 命名空间

using System;
using System.Collections;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using WinnerCMS.BLL;

#endregion

namespace WinnerCMS.WebUI.Admin.FriendLink
{
    /// <summary>
    ///     $codebehindclassname$ 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/"), WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class FriendLinkAJAX : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";


            var _myBLL = new BLL.FriendLinkCheck(context.Request["URL"].Replace("http://", ""));

            switch (context.Request["Action"])
            {
                case "Alexa":
                    context.Response.Write(_myBLL.GetAlexa().ToString());
                    break;

                case "Link":
                    context.Response.Write(_myBLL.CheckLink(WebConfig.DomainName.Replace("http://", "")));
                    break;
                case "Baidu":

                    context.Response.Write(_myBLL.GetBaiDu().ToString());
                    break;
                case "Google":
                    context.Response.Write(_myBLL.GetGoogle().ToString());
                    break;

                case "SoGou":
                    context.Response.Write(_myBLL.GetSoGou().ToString());
                    break;
                case "SoSo":
                    context.Response.Write(_myBLL.GetSoSo().ToString());
                    break;

                case "Yahoo":
                    context.Response.Write(_myBLL.GetYahoo().ToString());
                    break;
            }
        }

        public bool IsReusable
        {
            get { return false; }
        }
    }
}